package com.glq1218.foreground.controller;

import com.glq1218.authentication.dto.AuthenticationDTO;
import com.glq1218.common.handler.MyWebSocketHandler;
import com.glq1218.common.model.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author glq1218
 */
@RestController
@Tag(name = "测试", description = "测试模块")
public class TestController {
    @GetMapping("/test")
    @Operation(description = "测试接口")
    public String test(@RequestBody AuthenticationDTO authenticationDTO) {
        return authenticationDTO.toString();
    }

    @GetMapping("/getOnline")
    public Integer getOnline() {
        return MyWebSocketHandler.getOnlineCount();
    }

    @PostMapping("/system/upload")
    public Result<?> upload(@RequestParam("file") MultipartFile file) {
        System.out.println(file);
        return Result.ok("上传成功");
    }
}
